package com.longli.tank.chainofresponsibility;

import com.longli.tank.AbstractGameObject;
import com.longli.tank.Bullet;
import com.longli.tank.Tank;
import com.longli.tank.TankFrame;

/**
 * @author Longli
 */
public class BulletTankCollider implements Collider{
    @Override
    public void collide(AbstractGameObject go1, AbstractGameObject go2) {
        if(go1 instanceof Bullet && go2 instanceof Tank){
            Bullet b=(Bullet) go1;
            Tank t=(Tank)go2;
            b.collidesWithTank(t);
        }else {
            if(go2 instanceof Tank && go1 instanceof Bullet){
                collide(go2,go1);
            }
        }
    }
}
